import 'package:flutter/material.dart';
import 'package:flutter2/main.dart';

extension RouteAwareExt on RouteAware {
  addLife(State state) {
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      final route = ModalRoute.of(state.context);
      if (route is PageRoute) {
        routerObserver.subscribe(this, route);
      }
    });
  }
}
